<?= $this->extend('admin\_layouts\main_html') ?>

<?= $this->section('content') ?>
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">用户名</label>
      <div class="layui-input-inline">
      	<?php if(!empty($info)){?>
      	<div class="layui-form-mid layui-word-aux"><?=$info['username']?></div>
      	<!-- <input type="text" disabled value="<?=$info['username']?>" class="layui-input"> -->
      	<input type="hidden" name="username" value="<?=$info['username']?>">
      	<input type="hidden" name="id" value="<?=$info['id']?>">
      	<?php }else{?>
        <input type="text" name="username" lay-verify="required" placeholder="请输入用户名，不包含空格" autocomplete="off" class="layui-input">
        <?php }?>
      </div>
    </div>
    <div class="layui-form-item">
    	<label class="layui-form-label">新密码</label>
        <div class="layui-input-inline">
          <input type="password" name="password" lay-verify="<?php if(empty($info)){?>required|pass<?php }?>" autocomplete="off" id="LAY_password" class="layui-input" placeholder="6到16个字符,编辑时放空则代表不修改密码">
        </div>
        <!-- <div class="layui-form-mid layui-word-aux"></div> -->
  	</div>
  	<div class="layui-form-item">
        <label class="layui-form-label">确认新密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password_confirm" lay-verify="<?php if(empty($info)){?>required|repass<?php }?>" autocomplete="off" class="layui-input">
        </div>
  	</div>
    <div class="layui-form-item">
      <label class="layui-form-label">真实姓名</label>
      <div class="layui-input-inline">
        <input type="text" name="realname" lay-verify="required" placeholder="请输入2-4个汉字的姓名" autocomplete="off" class="layui-input" value="<?php echo esc($info['realname']);?>">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">手机号</label>
      <div class="layui-input-inline">
        <input type="text" name="mobile" lay-verify="required|phone" placeholder="请输入手机号码" autocomplete="off" class="layui-input" value="<?php echo esc($info['mobile']);?>">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">备注</label>
      <div class="layui-input-inline">
      	<textarea name="desc" placeholder="请输入内容" class="layui-textarea"><?php echo esc($info['desc']);?></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">状态</label>
      <div class="layui-input-block">
          <input type="radio" name="status" value="<?php echo COMMON_STATUS_ON;?>" title="<?php echo lang('common.status.'.COMMON_STATUS_ON);?>"<?php if($info['status']==COMMON_STATUS_ON || empty($info)){echo ' checked';}?>>
          <input type="radio" name="status" value="<?php echo COMMON_STATUS_OFF;?>" title="<?php echo lang('common.status.'.COMMON_STATUS_OFF)?>"<?php if($info['status']==COMMON_STATUS_OFF){echo ' checked';}?>>
      </div>
    </div>
    <div class="layui-form-item layui-hide">
    	<?=csrf_field()?>
      <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>
<?= $this->endSection() ?>

<?= $this->section('script') ?>
<script>
layui.use(['form'], function(){
	var $ = layui.$
    ,form = layui.form;
    
	// 增加两个验证
    form.verify({
    	pass: [/^[\S]{6,12}$/, "密码必须6到12位，且不能出现空格"],
        repass: function(t) {
            if (t !== $("#LAY_password").val()) return "两次密码输入不一致"
        }
    });
});
</script>
<?= $this->endSection() ?>